package com.example.bbgds.test.home.widget;

import android.content.Context;
import android.content.Intent;
import android.provider.Settings;

import com.example.bbgds.test.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zjzhu on 2016/4/26.
 */
public class WidgetDataMapping {

    private static List<AppItemTheme> mAppThemeList = new ArrayList<>();
    private static List<Intent> mAppLaunchIntentList = new ArrayList<>();
    private static List<ItemInfo> mAppList = null;

    static {
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget1, R.color.color_5e83e1));
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget2, R.color.color_e85eff));
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget3, R.color.color_50c7ff));
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget4, R.color.color_92cb77));
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget5, R.color.color_1adde6));
        mAppThemeList.add(new AppItemTheme(R.drawable.bg_appwidget6, R.color.color_c3cbce));
    }

    static {
        mAppLaunchIntentList.add(new Intent().setClassName("com.text.text", "com.text.text"));
        mAppLaunchIntentList.add(new Intent().setClassName("com.text.text", "com.text.text"));
        mAppLaunchIntentList.add(new Intent().setClassName("com.text.text", "com.text.text"));
        mAppLaunchIntentList.add(new Intent(Intent.ACTION_DIAL));
        mAppLaunchIntentList.add(new Intent().setClassName("com.text.text", "com.text.text"));
        mAppLaunchIntentList.add(new Intent(Settings.ACTION_SETTINGS));
    }

    public static List<AppItemTheme> getThemeList(){
        return mAppThemeList;
    }

    public static List<ItemInfo> getAllWidgetList(Context context){
        if (mAppList == null) {
            mAppList = new ArrayList<>();
            mAppList.add(new ItemInfo(ItemInfo.VIEWTYPE_MAIN));
            mAppList.add(new AppItemInfo(mAppThemeList.get(0), context.getString(R.string.appname_navi), R.drawable.ic_navi).setLaunchIntent(mAppLaunchIntentList.get(0)));
            mAppList.add(new AppItemInfo(mAppThemeList.get(1), context.getString(R.string.appname_music), R.drawable.ic_music).setLaunchIntent(mAppLaunchIntentList.get(1)));
            mAppList.add(new CameraAppItemInfo(context).setLaunchIntent(mAppLaunchIntentList.get(2)));
            mAppList.add(new AppItemInfo(mAppThemeList.get(3), context.getString(R.string.appname_phone), R.drawable.ic_dialer).setLaunchIntent(mAppLaunchIntentList.get(3)));
            mAppList.add(new AppItemInfo(mAppThemeList.get(4), context.getString(R.string.appname_adas), R.drawable.ic_adas).setLaunchIntent(mAppLaunchIntentList.get(4)));
            mAppList.add(new AppItemInfo(mAppThemeList.get(5), context.getString(R.string.appname_settins), R.drawable.ic_setting).setLaunchIntent(mAppLaunchIntentList.get(5)));
        }
        return mAppList;
    }

}
